<?php
	include("includes/config.php");
	include("includes/nav.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<title>
			<?PHP
				echo $site_name;
			?>
			:: Register
		</title>
	</head>
<body>
	<div align="center">
		<b>
			<u>
				<a href="index.php">
					<? echo "$site_name"; ?>
				</a>
			</u>
		</b>
	</div>
	<form method="post" action="">
		<table border="0" align="center">
			<tr>
				<td colspan="2">
					<center>
						Registration
					</center>
					<hr>
				</td>
			</tr>
			<tr>
				<td>
					<label>
						Username:
					</label>
				</td>
				<td>
					<input name="user" type="text">
				</td>
			</tr>
			<tr>
				<td>
					<label>
						Password:
					</label>
				</td>
				<td>
					<input name="pass" type="password">
				</td>
			</tr>
			<tr>
				<td>
					<label>
						Confirm Password:
					</label>
				</td>
				<td>
					<input name="pass2" type="text">
				</td>
			</tr>
			<tr>
				<td>
					<label>
						Real Name (Optional) :
					</label>
				</td>
				<td>
					<input name="name" type="text">
				</td>
			</tr>
			<tr>
				<td>
					<br>
					<div align="center">
						<input type="submit" name="submit" value="Submit">
					</div> 
				</td>
			</tr>
		</table>
		<br>
		<br>
<?php
	include("includes/db.php");
	$user = $_POST['user'];
	$pass = md5($_POST['pass']);
	$pass2 = md5($_POST['pass2']);
	$submit = $_POST['submit'];
	$name = $_POST['name'];
	if ($submit == "Submit")
	{
		if ($pass == $pass2)
		{
			$query = "INSERT INTO users VALUES ('', '$user', '$pass', '$name', '', '0')";

			mysql_query($query) or die(mysql_error());
			echo "Registration Succeeded! <a href='../login.php'>Click Here</a> To Login.";
		}
		else
		{
			echo "The supplied passwords do not match. Please try again.";
		}
	}
?>
		<hr>
		<div align="center"">
<?PHP
	echo "$site_foot";
?>
		</div>
	</body>
</html>
